package cn.fanyamin.util.collection;

/**
 * The Class TimingMaxValueList.
 * 
 * @author yafan
 */
public class TimingMaxValueList extends TimingSumValueList {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 3589046247487990776L;

    /**
     * Instantiates a new timing max value list.
     */
    public TimingMaxValueList() {
        super();
    }

    /**
     * Instantiates a new timing max value list.
     * 
     * @param size
     *            the size
     */
    public TimingMaxValueList(int size) {
        super(size);
    }

    /**
     * @param idx index of list
     * @param val value
     * 
     * @see com.webex.globalwatch.util.TimingSumValueList#updateMetrics(int,
     * long)
     */
    protected void updateMetrics(int idx, long val) {
        long oldVal = values.get(idx);
        if (-1 == oldVal) {
            values.insert(idx, val);
            return;
        }
        oldVal = Math.max(oldVal, val);
        values.insert(idx, oldVal);
    }
}
